﻿@{
    ViewData["Title"] = "首页";
}
@model IEnumerable<IVBlog.Models.Article>
<style>
    .banner_box{
        margin-top:200px;
        margin-bottom:300px;
    }
    .card {
        margin:20px auto;
    }
</style>
@if (ViewBag.pageIndex == 1 && TempData["Search"] == null)
{
    <div style="padding-top:20px">
        <div class="alert alert-warning alert-dismissible fade show" role="alert">
            <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
            <i class="bi bi-bell"></i>&nbsp;<strong>欢迎来到本站━(*｀∀´*)ノ亻!</strong>&nbsp;本站QQ交流群：@(ViewBag.Qqgroup)
        </div>
    </div>
    <div class="text-center banner_box">
        <h1 class="display-4">
            <span class="font-weight-bold">IV</span>&nbsp;&nbsp;
            <span class="font-weight-bold">的</span>&nbsp;&nbsp;
            <span class="font-weight-bold">小</span>&nbsp;&nbsp;
            <span class="font-weight-bold">茶</span>&nbsp;&nbsp;
            <span class="font-weight-bold">社</span>&nbsp;&nbsp;
        </h1>
        <p id="hitokoto_text">:D 一言获取中...</p>
    </div>
}
<br />
<div class="text-center">
    <h2>@TempData["Search"]</h2>
    @if (TempData["SearchReult"] != null)
    {
        <p>@TempData["SearchReult"]</p>
    }
</div>
@*<div class="card" style="width: 18rem;">
    <img src="..." class="card-img-top" alt="...">
    <div class="card-body">
    <h5 class="card-title">Card title</h5>
    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    <a href="#" class="btn btn-primary">Go somewhere</a>
    </div>
    </div>*@
@foreach (var item in Model)
{
    <div class="card w-75 ">
        <div class="card-header text-center">
            <h5 class="card-title"><a href="~/Home/Article/@item.ArticleId" class="card-link">@item.Aname</a></h5>
        </div>
        <div class="card-body text-center">
            <p class="card-text">@item.Asynopsis</p>
            <span data-toggle="tooltip" title="发布的日期"><i class="bi bi-calendar-minus"></i>&nbsp;@(string.Format("{0:d}", item.Atime))&nbsp;&nbsp;</span>
            <span data-toggle="tooltip" title="最后一次修改时间" style="display:@(item.AreTime==null?"none":"")"><i class="bi bi-calendar-week"></i>&nbsp;@item.AreTime&nbsp;&nbsp;</span>
            <p class="card-text">
                <a href="~/Home/Dynamic" class="card-link"><i class="bi bi-person"></i>&nbsp;@item.Author</a>&nbsp;&nbsp;
                <i class="bi bi-hand-thumbs-up"></i>&nbsp;<span data-toggle="tooltip" title="点赞数">@item.Likes</span>&nbsp;&nbsp;
                <i class="bi bi-chat-left-dots"></i>&nbsp;<span data-toggle="tooltip" title="评论数">@item.Remark.Count</span>&nbsp;&nbsp;
            </p>
        </div>
        <div class="card-footer bg-white">
            <i class="bi bi-folder2"></i><span class="card-text">&nbsp;<a href="~/Home/Type/@item.CategoryId" class="card-link">@item.Category.Cname</a></span>
        </div>
    </div>
}
@if (TempData["Search"] == null)
{
    <nav aria-label="Page navigation example">
        <ul class="pagination justify-content-center">
            <li class="page-item" style="display:@(ViewBag.pageIndex-1<=0?"none":"")">
                <a class="page-link" href="/Home/Index?pageIndex=@(ViewBag.pageIndex-1)&pageSize=@ViewBag.pageSize" aria-label="Previous">
                    <span aria-hidden="true">&laquo;</span>
                    <span class="sr-only">上一页</span>
                </a>
            </li>
            @for (int i = 1; i <= ViewBag.totalPage; i++)
            {
                <li class="page-item @(ViewBag.pageIndex==i?"active":"")"><a class="page-link" href="/Home/Index?pageIndex=@i&pageSize=@ViewBag.pageSize">@i</a></li>
            }
            <li class="page-item @(ViewBag.pageIndex+1>ViewBag.totalPage?"disabled":"")">
                <a class="page-link" href="/Home/Index?pageIndex=@(ViewBag.pageIndex+1)&pageSize=@ViewBag.pageSize" aria-label="Next">
                    <span aria-hidden="true">&raquo;</span>
                    <span class="sr-only">下一页</span>
                </a>
            </li>
        </ul>
    </nav>
}
